Skip to content

fix(desktop): log the window's web process to webview.log - #4253

Merged
LHagfoss merged 2 commits into
mainfrom
fix/desktop-webview-process-log
Nov 22, 2026
Merged

LHagfoss merged 2 commits into
mainfrom
fix/desktop-webview-process-log

Conversation

@LHagfoss

Copy link
Copy Markdown
Owner

What

On macOS, WebKit draws the window in its own process (com.apple.WebKit.WebContent, which Activity Monitor lists as tauri://localhost). launchd starts that process, not the app, so it is not listed under RustCode. A user saw it at about 1 GB, with the MacBook getting hot, and quit it. The window went blank, the page loaded again, and the engine restarted. None of this was recorded anywhere.

This adds webview.log in the config folder (same rolling format as updates.log, 400 lines):

  • webview.process: the web process's pid, memory (physical footprint) and CPU time when it is first seen
  • webview.process_replaced: the old and new pid, plus the old process's last and peak memory
  • webview.memory: each crossing of 1/2/4/8 GB, once per process
  • webview.busy: over 50% of a core for a whole minute (at the start, then every 10 min while it lasts)
  • webview.sample: an hourly summary
  • webview.reloaded: the page loaded again and the engine restarted for it (engine.rs)

It samples once a minute with _webProcessIdentifier (selector checked first) and proc_pid_rusage. It runs only on macOS; on other platforms it does nothing.

Changelog

The desktop app records the window's web process memory, CPU and restarts in webview.log, so a hot or bloated window leaves evidence.

Testing

cargo clippy --all-targets -D warnings and cargo fmt --check in apps/desktop/src-tauri. The decision logic has unit tests (CI). Checked the rusage_info_v0 layout against the running web process: it reads a 289 MB footprint, which matches footprint.

@github-actions github-actions Bot added the fix A bug fix label Nov 22, 2026
@LHagfoss
LHagfoss merged commit 7cbf67b into main Nov 22, 2026
10 checks passed
@LHagfoss
LHagfoss deleted the fix/desktop-webview-process-log branch November 22, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant